package com.neutech.view;

import java.util.Scanner;

public class adminView {

    private static Scanner input = new Scanner(System.in);
    public static void adminMenu(){
        int x = 0;
        System.out.println("欢迎使用饿了么管理员管理系统");
        System.out.println("1.登录");
        System.out.println("2.注册");
        System.out.println("3.返回");
        int L = input.nextInt();
        if(L == 1){
            x = adminLogon.adminOn();
            if(x == 0){
                System.out.println("没有此用户");
                adminMenu();
            }else {
                System.out.println("登陆成功");
                adminManageBusinessMenu();
            }
        } else if (L == 2) {
            x = adminLogon.register();
            if(x == 0){
                System.out.println("注册失败");
                adminMenu();
            }else {
                System.out.println("注册成功");
                adminMenu();
            }
        } else if (L == 3) {
            totalView.totalmenu();
        }
    }

    public static void adminManageBusinessMenu(){
        int x = 0 ;
        System.out.println("1.查询商家列表");
        System.out.println("2.输入商家名称查询");
        System.out.println("3.新建商家");
        System.out.println("4.修改商家信息");
        System.out.println("5.删除商家");
        System.out.println("6.返回");
        int L = input.nextInt();
        if(L == 1){
            adminLogon.adminInquiryBusiness();
            System.out.println("查询完成");
            adminManageBusinessMenu();
        } else if (L == 2) {
            adminLogon.adminNameManageBusiness();
            System.out.println("查询完成");
            adminManageBusinessMenu();
        } else if (L == 3) {
            adminLogon.adminAddBusiness();
            System.out.println("添加完成");
            adminManageBusinessMenu();
        } else if (L == 4) {
            adminLogon.adminUpdateBusiness();
            System.out.println("修改完成");
            adminManageBusinessMenu();
        } else if (L == 5) {
            adminLogon.adminDeleteBusiness();
            System.out.println("删除完成");
            adminManageBusinessMenu();
        } else if (L == 6) {
            adminMenu();
        }
    }
}
